package com.jimmy.tx.dao.impl;

import com.jimmy.tx.dao.UserDao;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

import javax.sql.DataSource;

/**
 * @version 1.0
 * @ ClassName UserDaoImpl
 * <p> TODO
 * @ author JIMMY
 * @ Date 2020/11/5 0005 下午 8:43
 */
public class UserDaoImpl extends JdbcDaoSupport implements UserDao {
    private DataSource dataSource;

    public void inMoney(String name, Double money) {
        String sql = "update account set money = money + ? where name = ?";
        this.getJdbcTemplate().update(sql,money,name);
    }

    public void outMoney(String name, Double money) {
        String sql = "update account set money = money - ? where name = ?";
        this.getJdbcTemplate().update(sql,money,name);
    }

    public void fn() {
        System.out.println("dao fn");
    }
}
